package com.scheduling.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.scheduling.common.annotation.Log;
import com.scheduling.common.core.controller.BaseController;
import com.scheduling.common.core.domain.AjaxResult;
import com.scheduling.common.enums.BusinessType;
import com.scheduling.system.domain.Workflowconfiguration;
import com.scheduling.system.service.IWorkflowconfigurationService;
import com.scheduling.common.utils.poi.ExcelUtil;
import com.scheduling.common.core.page.TableDataInfo;

/**
 * 工作流程配置Controller
 * 
 * @author mj
 * @date 2025-05-07
 */
@RestController
@RequestMapping("/system/workflowconfiguration")
public class WorkflowconfigurationController extends BaseController
{
    @Autowired
    private IWorkflowconfigurationService workflowconfigurationService;

    /**
     * 查询工作流程配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:workflowconfiguration:list')")
    @GetMapping("/list")
    public TableDataInfo list(Workflowconfiguration workflowconfiguration)
    {
        startPage();
        List<Workflowconfiguration> list = workflowconfigurationService.selectWorkflowconfigurationList(workflowconfiguration);
        return getDataTable(list);
    }

    /**
     * 导出工作流程配置列表
     */
    @PreAuthorize("@ss.hasPermi('system:workflowconfiguration:export')")
    @Log(title = "工作流程配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Workflowconfiguration workflowconfiguration)
    {
        List<Workflowconfiguration> list = workflowconfigurationService.selectWorkflowconfigurationList(workflowconfiguration);
        ExcelUtil<Workflowconfiguration> util = new ExcelUtil<Workflowconfiguration>(Workflowconfiguration.class);
        util.exportExcel(response, list, "工作流程配置数据");
    }

    /**
     * 获取工作流程配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:workflowconfiguration:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(workflowconfigurationService.selectWorkflowconfigurationById(id));
    }

    /**
     * 新增工作流程配置
     */
    @PreAuthorize("@ss.hasPermi('system:workflowconfiguration:add')")
    @Log(title = "工作流程配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Workflowconfiguration workflowconfiguration)
    {
        return toAjax(workflowconfigurationService.insertWorkflowconfiguration(workflowconfiguration));
    }

    /**
     * 修改工作流程配置
     */
    @PreAuthorize("@ss.hasPermi('system:workflowconfiguration:edit')")
    @Log(title = "工作流程配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Workflowconfiguration workflowconfiguration)
    {
        return toAjax(workflowconfigurationService.updateWorkflowconfiguration(workflowconfiguration));
    }

    /**
     * 删除工作流程配置
     */
    @PreAuthorize("@ss.hasPermi('system:workflowconfiguration:remove')")
    @Log(title = "工作流程配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(workflowconfigurationService.deleteWorkflowconfigurationByIds(ids));
    }
}
